package OODay03;

public class OODay03HomeWork {
/*

package OODay03;

public abstract class Animal {
    String name ;
    int age;
    String color;

    public Animal() {
    }

    public Animal(String name, int age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }

    public void drink(){
        System.out.println(age+"岁"+color+"色的"+name+"在喝水");
    }
    public abstract void eat();
}
package OODay03;

public interface Swim {
    void swim();
}
package OODay03;

public class Dog extends Animal implements Swim{
    public Dog(String name, int age, String color) {
        super(name, age, color);
    }

    @Override
    public void eat() {
        System.out.println(name+"再吃骨头");
    }

    @Override
    public void swim() {
        System.out.println(color+"颜色的"+age+"岁的狗狗在游泳");
    }

    public void lookhome(){
        System.out.println(name+"在看家");
    }
}
package OODay03;

public class Chick extends Animal {
    public Chick(String name, int age, String color) {
        super(name, age, color);
    }

    @Override
    public void eat() {
        System.out.println(name+"在吃小米");
    }

    public void layEggs(){
        System.out.println(name+"再下蛋");
    }


}
package OODay03;

public class Fish extends Animal implements Swim{
    public Fish(String name, int age, String color) {
        super(name, age, color);
    }

    @Override
    public void eat() {
        System.out.println(name+"在吃饲料");
    }

    @Override
    public void swim() {
        System.out.println(color+"颜色的"+age+"岁的"+name+"小鱼在游泳");
    }
}

    public class SwimTest {
        public static void main(String[] args) {
            //狗
            Dog dog = new Dog("大黄",2,"黄");
            dog.eat();
            dog.drink();
            dog.lookhome();
            dog.swim();

            Dog dog1 = new Dog("大绿",2,"绿");
            dog1.eat();
            dog1.drink();
            dog1.lookhome();
            dog1.swim();

            Dog dog2 = new Dog("大紫",2,"紫");
            dog2.eat();
            dog2.drink();
            dog2.lookhome();
            dog2.swim();

            //鸡
            Chick chick = new Chick("小黄",3,"黄");
            chick.eat();
            chick.drink();
            chick.layEggs();

            Chick chick1 = new Chick("小紫",3,"紫");
            chick1.eat();
            chick1.drink();
            chick1.layEggs();

            Chick chick2 = new Chick("小绿",3,"绿");
            chick2.eat();
            chick2.drink();
            chick2.layEggs();

            //鱼
            Fish fish = new Fish("小黑",4,"黑");
            fish.eat();
            fish.drink();
            fish.swim();

            Fish fish1 = new Fish("小青",4,"青");
            fish1.eat();
            fish1.drink();
            fish.swim();

            package OODay03;

import java.util.Arrays;


    public class RefArrayDemo {
        public static void main(String[] args) {

            Dog[] dogs = new Dog[3];
            dogs[0] = new Dog("大黄",1,"绿色");
            dogs[1] = new Dog("大绿",3,"黄色");
            dogs[2] = new Dog("大紫",2,"黑色");

            for (int i = 0; i < dogs.length; i++) {
                //System.out.println(dogs[i].name);
                dogs[i].eat();
            }

            Fish[] fish = new Fish[2];
            fish[0] = new Fish("大青",123,"小青色");
            fish[1] = new Fish("大啊",11245,"大绿色");

            for (int i = 0; i < fish.length; i++) {
                //System.out.println(fish[i].name);
                fish[i].eat();
            }

            Chick[] chicks = new Chick[3];
            chicks[0] = new Chick("大黄421",1231,"汗色");
            chicks[1] = new Chick("大黄2",163,"大紫色");
            chicks[2] = new Chick("大黄4",17865,"大红色");

            for (int i = 0; i < chicks.length; i++) {
                // System.out.println(chicks[i].name);
                chicks[i].eat();
            }
        }
    }







*/



}









